﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
using DataAccessLayer;
namespace ServiceLayer.Entity
{
    [DataContract]
    public class DeptRequisitionDetailW
    {
        int deptReqDetailID;
        string itemCode;
        int newRequestQty;
        int actualQty;
        int deptReqID;

        [DataMember]
        public int DeptReqDetailID
        {
            get { return deptReqDetailID; }
            set { deptReqDetailID = value; }
        }

        [DataMember]
        public string ItemCode
        {
            get { return itemCode; }
            set { itemCode = value; }
        }

        [DataMember]
        public int NewRequestQty
        {
            get { return newRequestQty; }
            set { newRequestQty = value; }
        }

        [DataMember]
        public int ActualQty
        {
            get { return actualQty; }
            set { actualQty = value; }
        }

        [DataMember]
        public int DeptReqID
        {
            get { return deptReqID; }
            set { deptReqID = value; }
        }

        public static DeptRequisitionDetailW convert(DeptRequisitionDetail deptRequisitionDetail)
        {
            DeptRequisitionDetailW u = new DeptRequisitionDetailW();

            u.DeptReqDetailID = deptRequisitionDetail.DeptReqDetailID;
            u.ItemCode = deptRequisitionDetail.ItemCode;
            u.NewRequestQty = deptRequisitionDetail.NewRequestQty.GetValueOrDefault();
            u.ActualQty = deptRequisitionDetail.ActualQty.GetValueOrDefault();
            u.DeptReqID = deptRequisitionDetail.DeptReqID.GetValueOrDefault();
            return u;
        }

        public static List<DeptRequisitionDetailW> convertList(List<DeptRequisitionDetail> list)
        {
            List<DeptRequisitionDetailW> listW = new List<DeptRequisitionDetailW>();

            foreach (DeptRequisitionDetail x in list)
            {
                listW.Add(convert(x));
            }
            return listW;
        }
    }
}